﻿namespace PlayMyLife.Definitions.StoryEvent
{
    [System.Serializable]
    public enum EventType : byte {
        NothingDelay,
        EnableOperate,
        Conversation,
        Choices,
        PlaceMove,
        SpecialResolve,
        GotItem,
        CreatePlace,
        CreateItem,
        CreateRole,
        PlaceChange,
        ItemChange,
        RoleChange,
        RelationChange,
        BgmPlay,
        SoundPlay,
    }

    [System.Serializable]
    public class WithinEventData {
        public EventType eventType;
        public long eventDelay;
        public string argsID;
    }

    [System.Serializable]
    public class EventStep {
        public long id;
        public EventType eventType;
        public string argsID;
        public WithinEventData[] withinEvents;
    }

    public class EventConfig {
        public System.Collections.Generic.Dictionary<long, EventStep> events;
        public System.Collections.Generic.Dictionary<string, string> args;

        public EventConfig DeepCopy() {
            var ret = new EventConfig();
            ret.events = new System.Collections.Generic.Dictionary<long, EventStep>(events);
            ret.args = new System.Collections.Generic.Dictionary<string, string>(args);
            return ret;
        }
    }

    [System.Serializable]
    public class EnableOperateEventArg {
        public bool enable;
    }

    [System.Serializable]
    public class ConversationEventArg {
        public long speaker;
        public string content;
        public long nextEventId;
    }

    [System.Serializable]
    public class ChoicesEventArg {
        public string title;
        public string[] texts;
        public long[] events;
    }

    [System.Serializable]
    public class PlaceMoveEventArg {
        public long placeId;
        public long roleId;
    }

    [System.Serializable]
    public class CreatePlaceEventArg : PlaceData { }

    [System.Serializable]
    public class CreateRoleEventArg : HumanProperty.HumanSelfData {
        public HumanProperty.RelationData[] relations;
    }
}